TEMPLATE = lib
TARGET = MyPlugin
QT += qml quick
CONFIG += plugin c++11

TARGET = $$qtLibraryTarget($$TARGET)
uri = MyPlugin

# Input
SOURCES += \
        myplugin_plugin.cpp \
        myitem.cpp

HEADERS += \
        myplugin_plugin.h \
        myitem.h

DISTFILES = qmldir \
    MyRect.qml

message("TARGET="$$TARGET)
message("OUT_PWD="$$OUT_PWD)
message("_PRO_FILE_PWD_="$$_PRO_FILE_PWD_)

!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
    copy_qmldir.target = $$OUT_PWD/qmldir
    copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
    copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
    QMAKE_EXTRA_TARGETS += copy_qmldir
    PRE_TARGETDEPS += $$copy_qmldir.target
}

qmldir.files = qmldir MyRect.qml
unix {
    installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
    qmldir.path = $$installPath
    target.path = $$installPath
    INSTALLS += target qmldir
}
win32 {
    installPath = E:/src_works/qt/qt_install/$$replace(uri, \\., /)
    qmldir.path = $$installPath
    target.path = $$installPath
    INSTALLS += target qmldir
}
